package com.example.ygp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.ygp.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


@Mapper
@Repository
public interface UserMapper extends BaseMapper<User> {

    @Select("select id,name,sex from t_user where id =#{id} and sex =#{sex}")
    List<User> getUsers(User user);


    @Insert("insert into t_user(name,sex) values (#{user.name},#{user.sex})")
    int addUsers(User user);



    @Insert("INSERT INTO t_user(name,sex) VALUES(#{user.name},#{user.sex})")
    @Options(useGeneratedKeys=true, keyProperty="user.id",keyColumn="id"  )
    int insertUser(@Param("user") User user);


}
